import Vue from 'vue';

import 'normalize.css/normalize.css'; // A modern alternative to CSS resets

import smoothscroll from 'smoothscroll-polyfill';

import { Avatar, Image, Popover, Input, Pagination, Button, Progress, Switch } from 'element-ui';

import App from './App.vue';
import store from './store';
import router from './router';

import '@/styles/index.less';
import '@/styles/miva-icon.less';
import '@/styles/miva-animation.css';

import '@/permission';

import mivaAvatar from '@/components/avatarModule/index.vue';
import mivaLink from '@/components/globalLink/index.vue';
import simpleLoading from '@/components/simpleLoading/index.vue';

import * as filters from './utils/filters';

smoothscroll.polyfill(); // 使用scroll平滑滚动库

Object.keys(filters).forEach((key) => { // 注册全局过滤器
    Vue.filter(key, filters[key]);
});

Vue.use(Avatar);
Vue.use(Image);
Vue.use(Popover);
Vue.use(Pagination);
Vue.use(Input);
Vue.use(Button);
Vue.use(Progress);
Vue.use(Switch);

Vue.component('mivaLink', mivaLink);
Vue.component('mivaAvatar', mivaAvatar);
Vue.component('simpleLoading', simpleLoading);

Vue.config.productionTip = false;

new Vue({
    router,
    store,
    render: h => h(App),
}).$mount('#app');
